﻿using strange.extensions.mediation.impl;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class StartMediator : EventMediator
{
    [Inject]
    public StartView StartView { get; set; }

    //绑定之后调用（View是activity）
    public override void OnRegister()
    {
        StartView.Double.onClick.AddListener(AddDouble);
        StartView.Single.onClick.AddListener(DontDouble);
    }



    //对应View删除之后调用
    public override void OnRemove()
    {
        StartView.Double.onClick.RemoveListener(AddDouble);
        StartView.Single.onClick.RemoveListener(DontDouble);
    }
    
    //加倍
    private void AddDouble()
    {
        //1. 改model
        //2. 删除面板
        //dispatcher  派发器
        dispatcher.Dispatch(CommandEvent.ChangeMultiple,2);
        Destroy(StartView.gameObject);

    }
    //不加倍
    private void DontDouble()
    {
        dispatcher.Dispatch(CommandEvent.ChangeMultiple, 1);
        Destroy(StartView.gameObject);
    }


}
